phase1: fix signing steps when only apk_key is defined main v24
authorPetr Štetiar <[email protected]>
Thu, 11 Dec 2025 18:13:05 +0000 (18:13 +0000)
committerPetr Štetiar <[email protected]>
Thu, 11 Dec 2025 19:05:20 +0000 (19:05 +0000)
Signing steps are currently skipped if only `apk_key` is configured for a
branch, because `IsSignEnabled` only checks for `usign_key` or `gpg_key`.

Fix this by explicitly checking for `apk_key`.

While at it, refactor the signing checks into dedicated helper functions
`IsApkSigningEnabled` and `IsGpgSigningEnabled` for better readability.

Signed-off-by: Petr Štetiar <[email protected]>
phase1/master.cfg

index e3dee371dd73a592cab070e670f597043cbcbb2d..de60972418942276d913ffe29e315e73e438a698 100644 (file)
@@ -88,7 +88,9 @@ def ini_parse_branch(section):
     b["src_url"] = section.get("source_url")
     b["src_key"] = section.get("source_password")
 
+    b["apk_key"] = section.get("apk_key")
     b["gpg_key"] = section.get("gpg_key")
+    b["gpg_keyid"] = section.get("gpg_keyid")
 
     b["usign_key"] = section.get("usign_key")
     usign_comment = "untrusted comment: " + name.replace("-", " ").title() + " key"
@@ -573,9 +575,24 @@ def IsUsignEnabled(step):
     return branch and branches[branch].get("usign_key")
 
 
-def IsSignEnabled(step):
+def IsApkSigningEnabled(step):
     branch = step.getProperty("branch")
-    return IsUsignEnabled(step) or branch and branches[branch].get("gpg_key")
+    return branch and branches[branch].get("apk_key")
+
+
+# gpg_key - contains the key in PGP format
+# gpg_keyid - contains the keyid of the key on the nk3 dongle
+def IsGpgSigningEnabled(step):
+    branch = step.getProperty("branch")
+    return branch and (
+        branches[branch].get("gpg_key") or branches[branch].get("gpg_keyid")
+    )
+
+
+def IsSignEnabled(step):
+    return (
+        IsUsignEnabled(step) or IsApkSigningEnabled(step) or IsGpgSigningEnabled(step)
+    )
 
 
 def IsKmodArchiveEnabled(step):